from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
import uvicorn

# 创建app对象
app = FastAPI()


# 路由函数（路径函数）
@app.get("/")
async def home(request: Request):
    data = {"message": "Hello World!"}
    rsp = JSONResponse(content=data, status_code=405)
    return rsp


if __name__ == "__main__":
    uvicorn.run("main:app", host="127.0.0.1", port=8000, reload=True)
